package com.ouc.openplatform.zykt.authManage.service.impl;

import java.util.List;

import org.apache.commons.beanutils.BeanUtils;

import com.ouc.openplatform.pojo.EUDataGridResult;
import com.ouc.openplatform.utils.EntityUtil;
import com.ouc.openplatform.zykt.authManage.dto.NJ_UserInfoDTO;
import com.ouc.openplatform.zykt.authManage.model.NJ_UserInfo;
import com.ouc.openplatform.zykt.authManage.service.NJ_ClientUserInfoService;
import com.ouc.openplatform.zykt.authManage.service.NJ_DepartmentStructureService;
import com.ouc.openplatform.zykt.authManage.service.NJ_RoleInfoService;
import com.ouc.openplatform.zykt.authManage.service.NJ_UserInfoService;
public class NJ_ClientUserInfoServiceImpl implements NJ_ClientUserInfoService{
	
	private NJ_UserInfoService nj_userInfoService;
	
	private NJ_RoleInfoService nj_roleInfoService;
	
	private NJ_DepartmentStructureService departmentStructureService;
    
	public NJ_UserInfoService getNj_userInfoService() {
		return nj_userInfoService;
	}

	public void setNj_userInfoService(NJ_UserInfoService nj_userInfoService) {
		this.nj_userInfoService = nj_userInfoService;
	}

	public NJ_RoleInfoService getNj_roleInfoService() {
		return nj_roleInfoService;
	}

	public void setNj_roleInfoService(NJ_RoleInfoService nj_roleInfoService) {
		this.nj_roleInfoService = nj_roleInfoService;
	}

	public NJ_DepartmentStructureService getDepartmentStructureService() {
		return departmentStructureService;
	}

	public void setDepartmentStructureService(
			NJ_DepartmentStructureService departmentStructureService) {
		this.departmentStructureService = departmentStructureService;
	}

	
	//1.保存用户信息-----sxl
	@Override
	public int saveUserInfo(NJ_UserInfoDTO userInfoDTO){
		NJ_UserInfo userInfo=new NJ_UserInfo();
		try {
			BeanUtils.copyProperties(userInfo, userInfoDTO);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return nj_userInfoService.saveUserInfo(userInfo);
	}
	
	//2.删除用户信息-----sxl
	@Override
	public int deleteUserInfo(int id){
		int flag=nj_userInfoService.deleteUserInfo(id);
		return flag;
	}
	
	//3.修改用户信息-----sxl
	@Override
	public int updateUserInfo(NJ_UserInfoDTO userInfoDTO){
		NJ_UserInfo userInfo=new NJ_UserInfo();
		try {
			BeanUtils.copyProperties(userInfo, userInfoDTO);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return nj_userInfoService.updateUserInfo(userInfo);
	}
	
	//4.获取所有用户信息-----sxl
	@Override
	public List<NJ_UserInfo> getUserInfo(NJ_UserInfo nj_userinf){
		//将实体类中为""的属性转换为null
		EntityUtil.changeEmpty2Null(nj_userinf);
		return nj_userInfoService.getUserInfo(nj_userinf);
	}
		
	//5.查询所有用户(easyui专用)-----sxl	
	@Override
	public EUDataGridResult getAllUserInfoBypage(NJ_UserInfo userinfo,int page, int rows) {
		return nj_userInfoService.getAllUserInfo(userinfo, page, rows);
	}

}
